#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :urls.py
# @Time      :2025/2/21 17:21
# @Author    :kk
from django.contrib import admin
from django.urls import path, include
from drf_yasg import openapi
# from drf_yasg.views import get_schema_view
# from rest_framework import permissions
from rest_framework.documentation import include_docs_urls
from rest_framework.routers import DefaultRouter
from article.views import ArticleViewSet, index
from rest_framework.schemas import get_schema_view

app_name = 'article'

router = DefaultRouter()
router.register(r'articles', ArticleViewSet)

# 配置 Swagger 文档
# schema_view = get_schema_view(
#     openapi.Info(
#         title="News API",
#         default_version='v1',
#         description="API文档",
#         terms_of_service="https://www.google.com/policies/terms/",
#         contact=openapi.Contact(email="contact@yourdomain.local"),
#         license=openapi.License(name="BSD License"),
#     ),
#     public=True,
#     permission_classes=(permissions.AllowAny,),
# )

# schema_view = get_schema_view(title="新闻API",description="获取新闻数据信息")

urlpatterns = [
    path('api/', include(router.urls)),
    path('', index, name='index'),
    # Swagger 文档 URL
    # path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
    # path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),

    # path('schema/', schema_view),
]
